﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_QuyenDuyetDonHang : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CboLoaiTien")]
        private ComboBox _CboLoaiTien;
        [AccessedThroughProperty("CmdCancel")]
        private Button _CmdCancel;
        [AccessedThroughProperty("CmdOK")]
        private Button _CmdOK;
        [AccessedThroughProperty("GroupBox1")]
        private GroupBox _GroupBox1;
        [AccessedThroughProperty("Label11")]
        private Label _Label11;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("VSListUser")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSListUser;
        private IContainer components;
        private bool IsLoaded;
        private clsNguoiDung objND;

        public Frm_QuyenDuyetDonHang()
        {
            base.Load += new EventHandler(this.Frm_QuyenDuyetDonHang_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.objND = new clsNguoiDung();
            this.IsLoaded = false;
            this.InitializeComponent();
        }

        private void CboLoaiTien_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.LoadData();
        }

        private void CmdCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void CmdOK_Click(object sender, EventArgs e)
        {
            if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboLoaiTien.SelectedValue), "", modGeneral.TypeOfValue.String).ToString().Trim() == "")
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn phải chọn loại tiền.", ""));
            }
            else
            {
                this.objND.ClearQuyenDuyetDonHang();
                C1.Win.C1FlexGrid.C1FlexGrid vSListUser = this.VSListUser;
                int num3 = this.VSListUser.Rows.Count - 1;
                for (int i = 1; i <= num3; i++)
                {
                    if (Conversion.Val(RuntimeHelpers.GetObjectValue(vSListUser[i, 4])) != 0.0)
                    {
                        int num2=0;
                        if ((Conversion.Val(RuntimeHelpers.GetObjectValue(vSListUser[i, 5])) + Conversion.Val(RuntimeHelpers.GetObjectValue(vSListUser[i, 6]))) == 0.0)
                        {
                            num2 = 1;
                        }
                        this.objND.UpdateQuyenDuyetDonHang(Conversions.ToString(vSListUser[i + 1, 3]), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboLoaiTien.SelectedValue), "", modGeneral.TypeOfValue.String).ToString().Trim(), 1, Conversion.Val(RuntimeHelpers.GetObjectValue(vSListUser[i, 5])), Conversion.Val(RuntimeHelpers.GetObjectValue(vSListUser[i, 6])), num2);
                    }
                }
                vSListUser = null;
                this.Dispose();
            }
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing && (this.components != null))
                {
                    this.components.Dispose();
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }

        private void Frm_QuyenDuyetDonHang_Load(object sender, EventArgs e)
        {
            BuildComboModule.BuildCombo(this.CboLoaiTien, modGeneral.ListDanhMuc.LoaiTien, false, "", "");
            this.CboLoaiTien.SelectedValue = "USD";
            this.IsLoaded = true;
            this.LoadData();
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_QuyenDuyetDonHang));
            this.GroupBox1 = new GroupBox();
            this.VSListUser = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel1 = new Panel();
            this.CmdCancel = new Button();
            this.CmdOK = new Button();
            this.CboLoaiTien = new ComboBox();
            this.Label11 = new Label();
            this.GroupBox1.SuspendLayout();
            this.VSListUser.BeginInit();
            this.Panel1.SuspendLayout();
            this.SuspendLayout();
            this.GroupBox1.BackColor = Color.Transparent;
            this.GroupBox1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.GroupBox1.Controls.Add(this.VSListUser);
            this.GroupBox1.Dock = DockStyle.Fill;
            Point point = new Point(0, 0x24);
            this.GroupBox1.Location = point;
            this.GroupBox1.Name = "GroupBox1";
            Size size = new Size(0x2f5, 0x1c5);
            this.GroupBox1.Size = size;
            this.GroupBox1.TabIndex = 70;
            this.GroupBox1.TabStop = false;
            this.GroupBox1.Text = "Danh s\x00e1ch người d\x00f9ng";
            this.VSListUser.AutoResize = false;
            this.VSListUser.BackColor = Color.WhiteSmoke;
            this.VSListUser.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Light3D;
            this.VSListUser.ColumnInfo = manager.GetString("VSListUser.ColumnInfo");
            this.VSListUser.Dock = DockStyle.Fill;
            this.VSListUser.ExtendLastCol = true;
            this.VSListUser.FocusRect = FocusRectEnum.None;
            point = new Point(3, 0x10);
            this.VSListUser.Location = point;
            this.VSListUser.Name = "VSListUser";
            this.VSListUser.Rows.Count = 1;
            this.VSListUser.Rows.DefaultSize = 0x11;
            this.VSListUser.SelectionMode = SelectionModeEnum.Row;
            size = new Size(0x2ef, 0x1b2);
            this.VSListUser.Size = size;
            this.VSListUser.StyleInfo = manager.GetString("VSListUser.StyleInfo");
            this.VSListUser.TabIndex = 0x41;
            this.VSListUser.VisualStyle = VisualStyle.Office2007Blue;
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.CmdCancel);
            this.Panel1.Controls.Add(this.CmdOK);
            this.Panel1.Controls.Add(this.CboLoaiTien);
            this.Panel1.Controls.Add(this.Label11);
            this.Panel1.Dock = DockStyle.Top;
            point = new Point(0, 0);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x2f5, 0x24);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x47;
            this.CmdCancel.DialogResult = DialogResult.Cancel;
            this.CmdCancel.Image = (Image) manager.GetObject("CmdCancel.Image");
            this.CmdCancel.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x29a, 6);
            this.CmdCancel.Location = point;
            this.CmdCancel.Name = "CmdCancel";
            size = new Size(0x4f, 0x18);
            this.CmdCancel.Size = size;
            this.CmdCancel.TabIndex = 0x10;
            this.CmdCancel.Text = "&Tho\x00e1t";
            this.CmdCancel.UseVisualStyleBackColor = true;
            this.CmdOK.Image = (Image) manager.GetObject("CmdOK.Image");
            this.CmdOK.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x247, 6);
            this.CmdOK.Location = point;
            this.CmdOK.Name = "CmdOK";
            size = new Size(0x4e, 0x18);
            this.CmdOK.Size = size;
            this.CmdOK.TabIndex = 15;
            this.CmdOK.Text = "&Chọn";
            this.CmdOK.UseVisualStyleBackColor = true;
            this.CboLoaiTien.DropDownStyle = ComboBoxStyle.DropDownList;
            this.CboLoaiTien.FormattingEnabled = true;
            point = new Point(0x4b, 8);
            this.CboLoaiTien.Location = point;
            this.CboLoaiTien.Name = "CboLoaiTien";
            size = new Size(0x7b, 0x15);
            this.CboLoaiTien.Size = size;
            this.CboLoaiTien.TabIndex = 14;
            this.Label11.AutoSize = true;
            this.Label11.BackColor = Color.Transparent;
            point = new Point(15, 12);
            this.Label11.Location = point;
            this.Label11.Name = "Label11";
            size = new Size(0x2f, 13);
            this.Label11.Size = size;
            this.Label11.TabIndex = 13;
            this.Label11.Text = "Loại tiền";
            this.Label11.TextAlign = ContentAlignment.TopRight;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            this.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            size = new Size(0x2f5, 0x1e9);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.GroupBox1);
            this.Controls.Add(this.Panel1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "Frm_QuyenDuyetDonHang";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "PHAN QUYEN DUYET DON HANG";
            this.GroupBox1.ResumeLayout(false);
            this.VSListUser.EndInit();
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.ResumeLayout(false);
        }

        public void LoadData()
        {
            if (this.IsLoaded && (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboLoaiTien.SelectedValue), "", modGeneral.TypeOfValue.String).ToString().Trim() != ""))
            {
                DataTable table = this.objND.ShowListQuyenDuyetDonHang(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboLoaiTien.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim());
                C1.Win.C1FlexGrid.C1FlexGrid vSListUser = this.VSListUser;
                vSListUser.Rows.Count = 1;
                int num2 = table.Rows.Count - 1;
                for (int i = 0; i <= num2; i++)
                {
                    vSListUser.AddItem("");
                    vSListUser[i + 1, 1] = RuntimeHelpers.GetObjectValue(table.Rows[i]["TenNhanVien"]);
                    vSListUser[i + 1, 2] = RuntimeHelpers.GetObjectValue(table.Rows[i]["NhomNguoiDung"]);
                    vSListUser[i + 1, 3] = RuntimeHelpers.GetObjectValue(table.Rows[i]["TenDangNhap"]);
                    vSListUser[i + 1, 4] = RuntimeHelpers.GetObjectValue(table.Rows[i]["DuocPhepDuyet"]);
                    vSListUser[i + 1, 5] = RuntimeHelpers.GetObjectValue(table.Rows[i]["GioiHanTu"]);
                    vSListUser[i + 1, 6] = RuntimeHelpers.GetObjectValue(table.Rows[i]["GioiHanDen"]);
                }
                vSListUser = null;
            }
        }

        private void VSListUser_BeforeEdit(object sender, RowColEventArgs e)
        {
            if (e.Col < 4)
            {
                e.Cancel = true;
            }
            else if ((e.Col != 4) && (Conversion.Val(RuntimeHelpers.GetObjectValue(this.VSListUser[e.Row, 4])) == 0.0))
            {
                e.Cancel = true;
            }
        }

        internal virtual ComboBox CboLoaiTien
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboLoaiTien;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CboLoaiTien_SelectedIndexChanged);
                if (this._CboLoaiTien != null)
                {
                    this._CboLoaiTien.SelectedIndexChanged -= handler;
                }
                this._CboLoaiTien = value;
                if (this._CboLoaiTien != null)
                {
                    this._CboLoaiTien.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual Button CmdCancel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdCancel_Click);
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click -= handler;
                }
                this._CmdCancel = value;
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click += handler;
                }
            }
        }

        internal virtual Button CmdOK
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdOK;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdOK_Click);
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click -= handler;
                }
                this._CmdOK = value;
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click += handler;
                }
            }
        }

        internal virtual GroupBox GroupBox1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox1 = value;
            }
        }

        internal virtual Label Label11
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label11;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label11 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSListUser
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSListUser;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                RowColEventHandler handler = new RowColEventHandler(this.VSListUser_BeforeEdit);
                if (this._VSListUser != null)
                {
                    this._VSListUser.BeforeEdit -= handler;
                }
                this._VSListUser = value;
                if (this._VSListUser != null)
                {
                    this._VSListUser.BeforeEdit += handler;
                }
            }
        }
    }
}

